package edu.fiu.cis.personalize.server.util;

import java.util.HashSet;
import java.util.Set;

public final class SetUtils {
	
	public  static <E> Set<E> intersect(Set<E> s1,Set<E> s2){
		Set<E> ret = new HashSet<E>();
		
		for (E e :s1){
			if (s2.contains(e)){
				ret.add(e);
			}
		}
		
		for (E e : s2){
			if (s1.contains(e)){
				ret.add(e);
			}
		}
		return ret;
	}
	
	public  static <E> Set<E> union(Set<E> s1,Set<E> s2){
		Set<E> ret = new HashSet<E>(s1);
		ret.addAll(s2);
		return ret;
	}

}
